#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H

#include <QWidget>
#include <QNetworkConfigurationManager>
#include <QHostInfo>
#include "checknetworkconnect.h"

QT_BEGIN_NAMESPACE
namespace Ui { class NetWorkManager; }
QT_END_NAMESPACE

class NetWorkManager : public QWidget
{
    Q_OBJECT

public:
    NetWorkManager(QWidget *parent = nullptr);
    ~NetWorkManager();

protected:
virtual void timerEvent(QTimerEvent *event);

    void checkNetworkConnect()
    {
        QHostInfo::lookupHost("www.baidu.com", this,SLOT(onLookupHost(QHostInfo)));
    }
private slots:
    void onLookupHost(QHostInfo host);
    void update_network_state(int);
private:
    Ui::NetWorkManager *ui;
    QNetworkConfigurationManager netManager;
    CheckNetWorkConnect *checkThread;
};
#endif // NETWORKMANAGER_H
